<!DOCTYPE html>
<html lang="en">
    <head>
        <title></title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <script src="./lib/vue-2.4.0.js"></script> 
        <!-- <link rel="stylesheet" href="./lib/animate.css"> -->
        <!-- <style>
        /* .v-enter,
        .v-leave-to{
            opacity: 0;
            transform: translateX(150px);
        }

        .v-enter-active,
        .v-leave-active{
            transition: all 0.8s ease;
        } */
        </style> -->
    </head>
    <body>
        <div id="app">
            <input type="button"  value="切换" @click = 'flag = !flag'>


            <transition 
            @before-enter="before"
            @enter="enter"
            @after-enter="after"
            >
            <p v-show='flag'>动画渐变</p>
            </transition>

        </div>
        <script>
            var vm = new Vue({
                el: '#app',
                data: {
                    flag:false
                },
                methods:{
                    before(el){
                        el.style.transform="translate(0,0)";
                    },
                    enter(el,done){
                        el.offsetWidth
                        el.style.transform="translate(200px,300px)";
                        el.style.transition="all 1s ease";

                        done()
                    },
                    after(el){

                        this.flag=!this.flag;
                    }
                }
            })
        </script>
    </body>
</html>